<?php
defined("_ALLOW") or die ("Access denied");
?>
<?php
isset($_SESSION['username']) or die ("Bạn chưa có tài khoản.<br />Vui lòng đăng ký <a href='index.php?module=com_userregister'>tại đây</a>");
($_SESSION['username'] != "") or die ("Bạn chưa có tài khoản.<br />Vui lòng đăng ký <a href='index.php?module=com_userregister'>tại đây</a>");
?>
<script language="javascript">
cursid = -1;
curcatid = -1;
</script>
<?php
include_once("class/cproductsection.php");
include_once("class/cproductcategory.php");
include_once("class/cphaply.php");
global $objphaply;
include_once("class/chuong.php");
global $objhuong;
include_once("class/cgiaodich.php");
global $objgiaodich;


	include_once("class/cmkuser.php");
	global $objmkuser;
	$objmkuser = $objmkuser->Doc($_SESSION['username']);

$idproduct = -1;
$sidproduct = -1;
$catidproduct = -1;
$codeproduct = "";
$titleproduct = "";
$introtextproduct = "";
$tag="";
$dongiaproduct = 0;
$tongtienproduct = 0;
$daiproduct = 0;
$rongproduct = 0;
$tongdientichproduct = 0;
$duongrongproduct = 0;
$diachiproduct = "";
$tid_phaplyproduct = -1;
$vip = 0;
$timenow = getdate();
$yearnow  = $timenow['year'];
$monthnow = $timenow['mon'];
if ($monthnow < 10) $monthnow = "0" . $monthnow;
$daynow = $timenow['mday'];
if ($daynow < 10) $daynow = "0" . $daynow;
$ttimeproduct = $yearnow."-".$monthnow."-".$daynow;
$tid_huongproduct = -1;
$tid_giaodichproduct = -1;
$lienheproduct = "";



$enableimg = true;
if (isset($_GET['id'])) {
	include_once("class/cproduct.php");
	global $objproduct;
	$objproduct = $objproduct->Doc($_GET['id']);
	if ($objproduct != null) {
		if ($objproduct->user == $_SESSION['username']) {
			$idproduct = $objproduct->id;
			$codeproduct = $objproduct->code;
			$sidproduct = $objproduct->sid;
			$catidproduct = $objproduct->catid;
			$titleproduct = $objproduct->title;
			$introtextproduct = $objproduct->introtext;
			$tag = $objproduct->tag;
			$vip = $objproduct->vip;
			$enableimg = false;
			
			$dongiaproduct = $objproduct->fdongia;
			//$tongtienproduct = $objproduct->tongtien;
			$daiproduct = $objproduct->dai;
			$rongproduct = $objproduct->rong;
			$tongdientichproduct = $objproduct->tongdientich;
			
			$tongtienproduct = $dongiaproduct*$tongdientichproduct;
			
			$duongrongproduct = $objproduct->duongrong;
			$diachiproduct = $objproduct->diachi;
			$tid_phaplyproduct = $objproduct->id_phaply;
			$vip = $objproduct->vip;
			$ttimeproduct = $objproduct->ttime;
			$tid_huongproduct = $objproduct->id_huong;
			$tid_giaodichproduct = $objproduct->id_giaodich;
			$lienheproduct = $objproduct->lienhe;
			?>
			<script language="javascript">
			cursid = <?php echo $sidproduct; ?>;
			curcatid = <?php echo $catidproduct; ?>;
			</script>
			<?php
		}
	}
}
?>
<?php
function addnewproduct () {
	$fileupload = $_FILES['imgproduct'];
	$resultupload = false;
	include_once("class/cproduct.php");
	global $objproduct;
	
	$objproduct->user = $_SESSION['username'];
	//$id = $_REQUEST['id'];

	$objproduct->sid = $_REQUEST['sidproduct'];

	$objproduct->catid = $_REQUEST['catidproduct'];
	$objproduct->code = $_REQUEST['codeproduct'];
	$objproduct->title = $_REQUEST['titleproduct'];
	$objproduct->introtext = $_REQUEST['introtextproduct'];
	$objproduct->image = "";
	$objproduct->dongia = 0;
	if ($_REQUEST['dongiaproduct'] != "") {
			$objproduct->dongia = $_REQUEST['dongiaproduct'];
			$objproduct->dongia = str_replace(",","",$objproduct->dongia);
		}
//	$objproduct->tongtien = $_REQUEST['tongtienproduct'];
	$objproduct->dai = $_REQUEST['daiproduct'];
	$objproduct->rong = $_REQUEST['rongproduct'];
	$objproduct->duongrong = $_REQUEST['duongrongproduct'];
	$objproduct->diachi = $_REQUEST['diachiproduct'];
	$objproduct->id_phaply = $_REQUEST['id_phaplyproduct'];

	$objproduct->id_huong = $_REQUEST['id_huongproduct'];
	$objproduct->id_giaodich = $_REQUEST['id_giaodichproduct'];
	$objproduct->lienhe = $_REQUEST['lienheproduct'];

	$objproduct->tag="";
	$objproduct->vip=0;
	if($objmkuser->vip == 1)
		$objproduct->vip=$_REQUEST['vip'];
	//$objproduct->ttime = $_REQUEST['time'];
		$timenow = getdate();
		$yearnow  = $timenow['year'];
		$monthnow = $timenow['mon'];
		if ($monthnow < 10) $monthnow = "0" . $monthnow;
		$daynow = $timenow['mday'];
		if ($daynow < 10) $daynow = "0" . $daynow;
		$gio = $timenow['hours'];
		$phut = $timenow['minutes'];
		$giay = $timenow['seconds'];
		$objproduct->lastupdate = $yearnow."-".$monthnow."-".$daynow."/".$gio.":".$phut.":".$giay;
		$objproduct->ttime=$objproduct->lastupdate;

	$objproduct->lastupdate = $objproduct->ttime;

	//if (is_file($fileupload['tmp_name'])) {
//		if (checksizeupload($fileupload,10)) {
//			$BASE_DIR = $_SERVER['DOCUMENT_ROOT'] ;
//			global $cfg_rootpath;
//			if ($cfg_rootpath == "") $BASE_ROOT = "\\images\\stories\\tmpupload";
//			else $BASE_ROOT = $cfg_rootpath . "\\images\\stories\\tmpupload"; 
//			$resultupload = do_upload($fileupload, $BASE_DIR.$BASE_ROOT."/");
//			if ($resultupload != "")
//				$objproduct->image = "tmpupload/".$resultupload;
//		}
//	}
	$neworder = $objproduct->GetMaxOrder() + 1;
	$tdtproduct = $objproduct->dai*$objproduct->rong;
	$thanhtienproduct=$tdtproduct*$objproduct->dongia;
	$strsql = "INSERT INTO `products` (`sid`, `catid`, `code`, `title`, `tag`, `introtext`,  `iorder`, `dongia`, `tongtien`, `dai`, `rong`, `tongdientich`, `duongrong`, `diachi`, `id_phaply`, `vip`, `time`, `lastupdate`, `id_huong`, `id_giaodich`, `lienhe`, `user`) ";
			$strsql .= "VALUES ($objproduct->sid, $objproduct->catid, '$objproduct->code', '$objproduct->title', '$objproduct->tag', '$objproduct->introtext', $neworder, $objproduct->dongia, $thanhtienproduct, $objproduct->dai, $objproduct->rong, $tdtproduct, $objproduct->duongrong, '$objproduct->diachi', $objproduct->id_phaply, $objproduct->vip, '$objproduct->ttime', '$objproduct->lastupdate', $objproduct->id_huong, $objproduct->id_giaodich, '$objproduct->lienhe', '$objproduct->user')";
echo $strsql;
	global $csdl;
	$csdl->Ghi($strsql);
	echo $objproduct->image;
	mosRedirect("?module=com_userlistproduct");
}
function updateproduct ($id) {
	include_once("class/cproduct.php");
	global $objproduct;
	$objproduct = $objproduct->Doc($id);
	if ($objproduct != null && $objproduct->user == $_SESSION['username']) {
		$objproduct->sid = $_REQUEST['sidproduct'];
		$objproduct->catid = $_REQUEST['catidproduct'];
		$objproduct->code = $_REQUEST['codeproduct'];
		$objproduct->title = $_REQUEST['titleproduct'];
		$objproduct->introtext = $_REQUEST['introtextproduct'];
		$objproduct->image = "";
		$objproduct->dongia = 0;
		if ($_REQUEST['dongiaproduct'] != "") {
			$objproduct->dongia = $_REQUEST['dongiaproduct'];
			$objproduct->dongia = str_replace(",","",$objproduct->dongia);
		}
		//$objproduct->tongtien = $_REQUEST['tongtienproduct'];
		$objproduct->dai = $_REQUEST['daiproduct'];
		$objproduct->rong = $_REQUEST['rongproduct'];
		$objproduct->duongrong = $_REQUEST['duongrongproduct'];
		$objproduct->diachi = $_REQUEST['diachiproduct'];
		$objproduct->id_phaply = $_REQUEST['id_phaplyproduct'];
		$objproduct->id_huong = $_REQUEST['id_huongproduct'];
		$objproduct->id_giaodich = $_REQUEST['id_giaodichproduct'];
		$objproduct->lienhe = $_REQUEST['lienheproduct'];
		$objproduct->vip=0;
		if($objmkuser->vip == 1)
			$objproduct->vip=$_REQUEST['vip'];
		
		
		$timenow = getdate();
		$yearnow  = $timenow['year'];
		$monthnow = $timenow['mon'];
		if ($monthnow < 10) $monthnow = "0" . $monthnow;
		$daynow = $timenow['mday'];
		if ($daynow < 10) $daynow = "0" . $daynow;
		$gio = $timenow['hours'];
		$phut = $timenow['minutes'];
		$giay = $timenow['seconds'];
		$ttimeproduct = $yearnow."-".$monthnow."-".$daynow.":".$gio.":".$phut.":".$giay;
		//$objproduct->lastupdate = $ttimeproduct;
		
	
//		if (is_file($fileupload['tmp_name'])) {
//		if (checksizeupload($fileupload,10)) {
//			$BASE_DIR = $_SERVER['DOCUMENT_ROOT'] ;
//			global $cfg_rootpath;
//			if ($cfg_rootpath == "") $BASE_ROOT = "\\images\\stories\\tmpupload";
//			else $BASE_ROOT = $cfg_rootpath . "\\images\\stories\\tmpupload"; 
//			$resultupload = do_upload($fileupload, $BASE_DIR.$BASE_ROOT."/");
//			if ($resultupload != "")
//				$objproduct->image = "tmpupload/".$resultupload;
//		}
//	}
		
		
		$tdt = $objproduct->dai*$objproduct->rong;
		$thanhtienproduct=$tdt*$objproduct->dongia;
		$strsql = "UPDATE `products` SET ";
			$strsql .= "`sid`=$objproduct->sid, ";
			$strsql .= "`catid`=$objproduct->catid, ";
			$strsql .= "`code` = '$objproduct->code', ";
			$strsql .= "`title`='$objproduct->title', ";
			$strsql .= "`tag`='', ";
			$strsql .= "`introtext`='$objproduct->introtext', ";
			//$strsql .= "`image`='$objproduct->image', ";
			$strsql .= "`dongia`=$objproduct->dongia, ";
			$strsql .= "`tongtien`=$thanhtienproduct, ";
			$strsql .= "`dai`=$objproduct->dai, ";
			$strsql .= "`rong`=$objproduct->rong, ";
			$strsql .= "`tongdientich`=$tdt, ";
			$strsql .= "`duongrong`=$objproduct->duongrong, ";
			$strsql .= "`diachi`='$objproduct->diachi', ";
			$strsql .= "`id_phaply`=$objproduct->id_phaply, ";
			$strsql .= "`lastupdate` = '$ttimeproduct', ";
			$strsql .= "`id_huong`=$objproduct->id_huong, ";
			$strsql .= "`id_giaodich`=$objproduct->id_giaodich, ";
			$strsql .= "`vip`=$objproduct->vip, ";
			$strsql .= "`lienhe`='$objproduct->lienhe' ";
			$strsql .= "WHERE `id`=$objproduct->id";
			echo $strsql;
			global $csdl;
		$csdl->Ghi($strsql);
		mosRedirect("?module=com_userlistproduct");
	}
}
if (isset($_REQUEST['submit'])) {
	//$sidcheck = $_REQUEST['sidcheck'];
	//if ($_SESSION['randomregister'] != "" && $sidcheck == $_SESSION['randomregister']) {
//		unset($_SESSION['randomregister']);
		$idproduct = $_REQUEST['idproduct'];
		if ($idproduct < 0)
			addnewproduct();
		else
			updateproduct($idproduct);
	//}
//	else echo "Mã xác nhận không hợp lệ.";
}
else {
?>
<script language="javascript">
asid = new Array();
i=0;
acatid = new Array();
function checkuseraddproduct(form) {
	myvalidate(form.titleproduct);
	if (form.titleproduct.value=="") {
		form.titleproduct.focus();
		alert("Vui lòng nhập tên sản phẩm");
		return false;
	}
	myvalidate(form.tongtienproduct);
	if (form.tongtienproduct.value=="") {
		form.tongtienproduct.focus();
		alert("Vui lòng nhập tổng thành tiền");
		return false;
	}
	myvalidate(form.tongdientichproduct);
	if (form.tongdientichproduct.value=="") {
		form.tongdientichproduct.focus();
		alert("Vui lòng nhập tổng diện tích");
		return false;
	}
	myvalidate(form.duongrongproduct);
	if (form.duongrongproduct.value=="") {
		form.duongrongproduct.focus();
		alert("Vui lòng nhập chiều rộng đường");
		return false;
	}
	
	//if (!checknumber(form.priceproduct))
//		form.priceproduct.value=0;
//	else if (form.priceproduct.value < 0)
//		form.priceproduct.value=0;
	myvalidate(form.imgproduct);
	myconvert(form.titleproduct);
	myconvert(form.introtextproduct);
	
	return true;
}
function myvalidate(frmcontrol) {
	value = frmcontrol.value;
	value = trim(value);
	frmcontrol.value=value;
}
function myconvert (frmcontrol) {
	value = frmcontrol.value;
	value = value.replace(/'/gim,"''");
	frmcontrol.value=value;
}
</script>
<?php
	  	$strrandom = "";
	  	$random = rand(10000,99999);
		$random = md5($random);
		$i=0;
		$randindex = 0;
		for ($i=0; $i<6; $i++) {
			$randindex = rand(0,31);
			$strrandom .= substr($random,$randindex,1);
		}
		$_SESSION['randomregister'] = $strrandom;
	  ?>
<?php
include_once("class/cproductsection.php");
global $objproductsection;
$arraysection = $objproductsection->Doc_danh_sach();
if (is_array($arraysection)) {
	include_once("class/cproductcategory.php");
	global $objproductcategory;
	echo "<script language='javascript'>";
	$indexsid = 0;
	$indexcatid = 0;
	foreach ($arraysection as $objproductsection) {
		$sid = $objproductsection->id;
		$tsid = $objproductsection->title;
		echo "asid[$indexsid]=new Array($sid, '$tsid');";
		$arraycategory = $objproductcategory->Doc_danh_sach($sid);
		if (is_array($arraycategory)) {
			foreach ($arraycategory as $objproductcategory) {
				$catid = $objproductcategory->id;
				$tcatid = $objproductcategory->title;
				echo "acatid[$indexcatid]=new Array($sid, $catid, '$tcatid');";
				$indexcatid++;
			}
		}
		$indexsid++;
	}
	echo "</script>";
}
?>
<script language="javascript">
function changesid(objselect) {
	objcatid = document.frmaddproduct.catidproduct;
	lengthcatid = objcatid.length;
	while (lengthcatid > 0) {
		objcatid.remove(lengthcatid-1);
		lengthcatid = objcatid.length;
	}
	
	lcatid = acatid.length;
	objsid = document.frmaddproduct.sidproduct;
	indexselectedsid = objsid.selectedIndex;
	optionsid = objsid[indexselectedsid].value;
	i=0;
	indexcatid = 0;
	for (i=0; i<lcatid; i++) {
		if (acatid[i][0] == optionsid) {
			objcatid[indexcatid] = new Option(acatid[i][2], acatid[i][1]);
			indexcatid++;
		}
	}
}
</script>
<form action="index.php?module=com_useraddproduct" method="post" enctype="multipart/form-data" name="frmaddproduct" id="frmaddproduct" onSubmit="return checkuseraddproduct(this)">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
	<tr>
		<td  align="center">
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
									<tr>
										<td style="background-image:url(images/search1.jpg); background-repeat:no-repeat" width="16" height="35"></td>
										<td style="background-image:url(images/search2.jpg); background-repeat:repeat-x; font-family:Tahoma; font-size:12px; font-weight:bold; text-transform:uppercase; text-align:center; color:#FFFFFF">THÔNG TIN SẢN PHẨM</td>
										<td style="background-image:url(images/search3.jpg); background-repeat:no-repeat" width="15" height="35"></td>
									</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td style="background-image:url(images/search4.jpg); background-repeat:repeat-y; padding-top:10px; padding-bottom:6px;">
			
			<table width="90%" border="0" align="center" cellpadding="0" cellspacing="2" class="com_user">
  
  
  <tr>
    <td width="21%">Code</td>
    <td width="79%" colspan="2"><input name="codeproduct" type="text" id="codeproduct" value="<?php echo $codeproduct; ?>" size="10" maxlength="10">
      <input name="idproduct" type="hidden" id="idproduct" value="<?php echo $idproduct; ?>" /></td>
  </tr>
  <tr>
    <td>Tiêu đề </td>
    <td colspan="2"><input name="titleproduct" type="text" id="titleproduct" onChange="this.value = trim(this.value)" value="<?php echo $titleproduct; ?>" size="40" maxlength="50"></td>
  </tr>
  <tr>
				  <td>Đơn giá </td>
				  <td colspan="2"><input name="dongiaproduct" type="text" id="dongiaproduct" class="text_area" value="<?php echo $dongiaproduct; ?>" /></td>
				  </tr>
				  
				  <tr>
				  <td>Diện tích </td>
				  <td colspan="2"><input name="rongproduct" type="text" class="text_area" id="rongproduct" value="<?php echo $rongproduct; ?>" size="5" maxlength="255" /> x <input name="daiproduct" type="text" class="text_area" id="daiproduct" value="<?php echo $daiproduct; ?>" size="5" maxlength="255" /> 
				    (Rộng x Dài)</td>
				  </tr>
				  
				  <tr>
				  <td>Đường rộng </td>
				  <td colspan="2"><input name="duongrongproduct" type="text" class="text_area" id="duongrongproduct" value="<?php echo $duongrongproduct; ?>" size="50" maxlength="255" /></td>
				  </tr>
				  <tr>
				  <td>Địa chỉ </td>
				  <td colspan="2"><p>
				    <input name="diachiproduct" type="text" class="text_area" id="diachiproduct" value="<?php echo $diachiproduct; ?>" size="50" maxlength="255" />
				  </p>				    </td>
				  </tr>
				  <tr>
				  <td>Liên hệ </td>
				  <td colspan="2"><p>
				    <input name="lienheproduct" type="text" class="text_area" id="lienheproduct" value="<?php echo $lienheproduct; ?>" size="50" maxlength="255" />
				  </p>				    </td>
				  </tr>
				  
				  <tr>
				  <td>Tình trạng pháp lý </td>
				  <td colspan="2">
				  <?php
				  $arrayphaply = $objphaply->Doc_danh_sach();
				  ?>
				  <select name="id_phaplyproduct" size="1" class="inputbox" id="id_phaplyproduct" >
	<option value="-1" <?php if ($tid_phaplyproduct==-1) echo "selected='selected'"; ?> >- Chọn ... -</option>
	<?php
		if (is_array($arrayphaply)) {
			$count = count($arrayphaply);
			for ($i=0; $i<$count; $i++) {
	?>
		<option value="<?php echo $arrayphaply[$i]->id; ?>" <?php if ($tid_phaplyproduct==$arrayphaply[$i]->id) echo "selected='selected'"; ?> ><?php echo $arrayphaply[$i]->title; ?> </option>
	<?php
			}
		}
	?>
</select>				  </td>
				  </tr>
				  <tr>
				  <td>Hướng </td>
				  <td colspan="2">
				  <?php
				  $arrayhuong = $objhuong->Doc_danh_sach();
				  ?>
				  <select name="id_huongproduct" size="1" class="inputbox" id="id_huongproduct" >
	<option value="-1" <?php if ($tid_huongproduct==-1) echo "selected='selected'"; ?> >- Chọn ... -</option>
	<?php
		if (is_array($arrayhuong)) {
			$count = count($arrayhuong);
			for ($i=0; $i<$count; $i++) {
	?>
		<option value="<?php echo $arrayhuong[$i]->id; ?>" <?php if ($tid_huongproduct==$arrayhuong[$i]->id) echo "selected='selected'"; ?> ><?php echo $arrayhuong[$i]->title; ?> </option>
	<?php
			}
		}
	?>
</select>				  </td>
				  </tr>
				  <tr>
				  <td>Loại giao dịch </td>
				  <td colspan="2">
				  <?php
				  $arraygiaodich = $objgiaodich->Doc_danh_sach();
				  ?>
				  <select name="id_giaodichproduct" size="1" class="inputbox" id="id_giaodichproduct" >
	<option value="-1" <?php if ($tid_giaodichproduct==-1) echo "selected='selected'"; ?> >- Chọn ... -</option>
	<?php
		if (is_array($arraygiaodich)) {
			$count = count($arraygiaodich);
			for ($i=0; $i<$count; $i++) {
	?>
		<option value="<?php echo $arraygiaodich[$i]->id; ?>" <?php if ($tid_giaodichproduct==$arraygiaodich[$i]->id) echo "selected='selected'"; ?> ><?php echo $arraygiaodich[$i]->title; ?> </option>
	<?php
			}
		}
	?>
</select>				  </td>
				  </tr>
				

				  
  <tr>
    <td valign="top">Quận/Huyện</td>
    <td colspan="2"><select name="sidproduct" size="1" id="sidproduct" onchange="changesid(this)">
    </select>
	<script language="javascript">
	lsid = asid.length;
	objsid = document.frmaddproduct.sidproduct;
	for (i=0; i<lsid; i++) {
		objsid[i] = new Option(asid[i][1], asid[i][0]);
	}
	if (cursid > 0) {
		for (i=0; i<lsid; i++) {
			if (objsid[i].value == cursid) {
				objsid.selectedIndex = i;
				break;
			} 
		}
	}
	</script>    </td>
  </tr>
  <tr>
    <td valign="top">Loại BĐS </td>
    <td colspan="2"><select name="catidproduct" size="1" id="catidproduct">
    </select>
	<script language="javascript">
	lcatid = acatid.length;
	if (lsid > 0) {
		objcatid = document.frmaddproduct.catidproduct;
		objsid = document.frmaddproduct.sidproduct;
		
		
		/*for (i=0; i<lsid; i++) {
		objsid[i] = new Option(asid[i][1], asid[i][0]);
		}
		if (cursid > 0) {
			for (i=0; i<lsid; i++) {
				if (objsid[i].value == cursid) {
					objsid.selectedIndex = i;
					
					break;
				} 
			}*/
		
		
		indexcatid = 0;
		for (i=0; i<lcatid; i++) {
			if (acatid[i][0] == cursid) {
				objcatid[indexcatid] = new Option(acatid[i][2], acatid[i][1]);
				indexcatid++;
			}
		}
		if (curcatid > 0) {
			for (i=0; i<indexcatid; i++)
				if (objcatid[i].value == curcatid) {
					objcatid.selectedIndex = i;
					/*alert(i);
					alert(curcatid);*/
					break;
				}
		}
		
	}
	</script>   </td>
  </tr>
  <tr>
    <td valign="top">Nội dung tóm lược </td>
    <td colspan="2"><textarea name="introtextproduct" cols="40" rows="5" id="introtextproduct" onChange="this.value=trim(this.value)"><?php echo $introtextproduct; ?></textarea></td>
  </tr>
  
  <?php	
  	
	if($objmkuser->vip == 1)
	{
  ?>
  <tr>
				  <td valign="top">VIP</td>
				  <td colspan="2"><input name="vip" type="text" class="text_area" id="vip" value="<?php echo $vip; ?>" size="2" maxlength="50" /> <strong>(1: VIP)</strong></td>
	</tr>
  <?php
  	}
  ?>
  <?php //if ($enableimg) { ?>
  <!--<tr>
    <td>Hình ảnh</td>
    <td colspan="2"><input name="imgproduct" type="file" id="imgproduct" onChange="this.value=trim(this.value)">
    (.jpg, .gif, .bmp) </td>
  </tr>-->
  <?php //} ?>
  
  <tr>
    <td>&nbsp;</td>
    <td colspan="2"><input name="submit" type="submit" id="submit" value="Submit">
      <input type="reset" name="Reset" value="Reset" /></td>
  </tr>
</table>
			
			
			
		</td>
	</tr>
	<tr>
		<td style="background-image:url(images/search5.jpg)" height="9">
		</td>
	</tr>
</table>


</form>
<?php } ?>